package example1;

/**
 * <h3>designPattern</h3>
 * <p>HummerH2车型</p>
 * @author : zhang.bw
 * @date : 2021-02-27 17:31
 **/
public class HummerH2 extends HummerModel {

	private boolean alarmFlag = true; //判断标记

	@Override
	public void start() {
		System.out.println("H2发动……");
	}

	@Override
	public void stop() {
		System.out.println("H2停止……");
	}

	@Override
	public void alarm() {
		System.out.println("H2鸣笛……");
	}

	@Override
	public void engineBoom() {
		System.out.println("H2轰鸣……");
	}

	@Override
	protected boolean isAlarm() { //覆写isAlarm方法，返回判断标记
		return this.alarmFlag;
	}

	public void setAlarm(boolean isAlarm) { //设置判断标记
		this.alarmFlag = isAlarm;
	}

	/*@Override
	public void run() {
		this.start();
		this.engineBoom();
		this.alarm();
		this.stop();
	}*/
}
